#include <bits/stdc++.h>
using namespace std;
const int N=305;
int n;
int a[N],pre[N];
int main(void){
    while(~scanf("%d",&n)){
        memset(a,0,sizeof(a));
        memset(pre,0,sizeof(pre));
        int sum=0;
        for(int i=1;i<=n;i++){
            scanf("%d",&a[i]);
            sum+=a[i];
            pre[i]=pre[i-1]+a[i];
        }
        int cnt=0;
        for(int i=1;i<=n;i++){
            for(int j=i+1;j<=n;j++){
                for(int k=j+1;k<=n;k++){
                    for(int l=k+1;l<=n;l++){
                        if(pre[j]-pre[i]==pre[l]-pre[k] && pre[k]-pre[j]==pre[i]+sum-pre[l]){
                            cnt++;
                        }
                    }
                }
            }
        }
        printf("%d\n",cnt);
    }
    return 0;
}